<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link rel="stylesheet" type="text/css" href="../../../../css/admin.css"/>
<script type="text/javascript" src="../../../../js/jquery.js"></script>
<script type="text/javascript" src="../../../../js/date_util.js"></script>
<script type="text/javascript" src="../../../../js/changebgcolor.js"></script>
<script type="text/javascript" src="../../../../js/calendar.js"></script>
<script type="text/javascript" src="../../../../js/ui_util.js"></script>
<script type="text/javascript" src="../../js/merchandise_init.js"></script>

<script type="text/javascript">
window.onload = function (){
	var date = new Date();
	var str_date = date.Format('yyyy-MM');
	var day = new Date(date.getFullYear(), date.getMonth()+1,0).getDate();
	$('#begin_date').val(str_date+'-01');
	$('#end_date').val(str_date+'-'+day);
	document.title = '收获金属原材料/产品/设备/耗材/工具/包装物料统计表';
	create_parent_type_list();
};
function getReport(){
	var begin_date = $('#begin_date').val();
	var end_date = $('#end_date').val();
	var merchandise_type = $('#merchandise_type').val();
	var merchandise_name = $('#merchandise_name').val();
	
	var url = '/storage/manager/pages/report.do?method=report1&d=' + new Date();
	url = url + '&begin=' + begin_date;
	url = url + '&end=' + end_date;
	url = url + '&merchandise_type=' + merchandise_type;
	url = url + '&merchandise_name=' + escape(escape(merchandise_name));
	
	$.getJSON(url, {}, function(data){
		$('#resultList').html('');
		var infoList = new Array();
		var _max = get_max_line(238,25);
		var pic = document.getElementById("pic");
		pic.innerHTML = '';
		if(data!=''){
			for(var i=0;i<data.length;i++){
				var style_border = 'style="border-bottom:0; border-top:1px;"';//0-(0-i-1)==data.length&&data.length>=_max?'style="border-bottom:0;"':'';
				var result = '';
				result = result +  '<tr style="height:25px;" onmouseover="cbgcolor(this,0)" onmouseout="cbgcolor(this,1)">';
				result = result +  '  <td class="list" ' + style_border + ' width="100">' + i + '</td>';
				result = result +  '  <td class="list" ' + style_border + ' width=""   >' + data[i][1] + '</td>';
				result = result +  '  <td class="list" ' + style_border + ' width="150">' + data[i][2] + '</td>';
				result = result +  '  <td class="list" ' + style_border + ' width="90" >' + data[i][3] + '</td>';
				result = result +  '  <td class="list" ' + style_border + ' width="90" >' + data[i][4] + '</td>';
				result = result +  '  <td class="list" ' + style_border + ' width="90" >' + data[i][5] + '</td>';
				result = result +  '  <td class="list" ' + style_border + ' width="90" >' + data[i][6] + '</td>';
				result = result +  '</tr>';
				$('#resultList').append(result);
				infoList[i] = escape(escape(data[i] + '!!'));
			}
			createReportIMG(infoList);
		}
	});
};
function createReportIMG(infoList) {
	var url = '/storage/manager/pages/report.do?method=report1IMG&d=' + new Date();
	url = url + '&infoList=' + infoList;

	$.post(url, {}, function (data){
		var pic = document.getElementById("pic");
		pic.innerHTML = data;
	});
};
</script>
</head>
<body>
<div align="right" style="margin-top:5px; margin-bottom:10px; padding-right:5px;">
  开始日期&nbsp;<input id="begin_date" onclick="calendar.setHook(this);" readonly="readonly" size="10" style="cursor:pointer;" />&nbsp;
  结束日期&nbsp;<input id="end_date"   onclick="calendar.setHook(this);" readonly="readonly" size="10" style="cursor:pointer;" />&nbsp;
  父类&nbsp;<select id="parent_type" onchange="selectMerchandiseType()" ></select>&nbsp;
  类别&nbsp;<select id="merchandise_type" ></select>&nbsp;
  名称&nbsp;<input  id="merchandise_name" type="text" style="width:80px;" />&nbsp;
  <input type="button" value="统计" class="button"  onclick="getReport()" style="width:80px; color:red; font-weight:bolder;" /> 
</div>
<div align="center">
  <div id="pic" style="margin-bottom:10px; margin-left:5px; margin-right:5px; height:250px; background-color:#efefef;" ></div>
  <table class="list" border="0" cellspacing="1" width="800"  >
    <thead>
      <tr style="height:15px;">
        <th class="list" width="100"> 序号</th>
        <th class="list" width="">名称</th>
        <th class="list" width="150">规格</th>
        <th class="list" width="90">上期库存</th>
        <th class="list" width="90">本期购进</th>
        <th class="list" width="90">本期出库</th>
        <th class="list" width="90">本期库存</th>
        <th class="list" width="15" >&nbsp;</th>
      </tr>
    </thead>    
    <tbody>
      <tr>
        <td style="padding:0; margin:0;" colspan="8">
        <div style="width:100%; height:238px; overflow-y:scroll; padding:0; margin:0;">
          <table id="resultList" class="list" border="0" cellspacing="1" style="border:0; width:781px; height:100%; "  >
			<tr>
			  <td style="border-bottom:0;" class="list" width="100">&nbsp;</td>
			  <td style="border-bottom:0;" class="list" width="">&nbsp;</td>
			  <td style="border-bottom:0;" class="list" width="150">&nbsp;</td>
			  <td style="border-bottom:0;" class="list" width="90">&nbsp;</td>
			  <td style="border-bottom:0;" class="list" width="90">&nbsp;</td>
			  <td style="border-bottom:0;" class="list" width="90">&nbsp;</td>
			  <td style="border-bottom:0;" class="list" width="90">&nbsp;</td>
			</tr>
          </table>
        </div>
        </td>
      </tr>
    </tbody>
  </table>
</div>

</body>
</html>
